import { useImperativeHandle } from "react";

const Menu1 = (props: any, ref: any) => {
	let { getNum } = props;
	useImperativeHandle(
		props.innerRef,
		() => ({ add })
		//父组件通过ref获取值，要在这里抛出
	);
	function testFun() {
		getNum("test");
	}
	const add = () => {
		console.log("add11");
	};
	console.log("ref", ref);
	return (
		<div className="" onClick={() => testFun()}>
			123
		</div>
	);
};

export default Menu1;
